home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / ooptesample / tecommon.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  5.9 KB  |  161 lines

  1. /*---------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    OOPTESample
  8. #
  9. #    TECommon.h        -    Constant Defintions
  10. #
  11. #    Copyright © 1988, 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:        
  15. #                    1.00                    04/89
  16. #                    1.10                    02/90
  17. #                    1.11                    10/92
  18. #
  19. #    Components:     
  20. #                    BuildOOPTESample            February 1, 1990
  21. #                    MTESample.p                    February 1, 1990
  22. #                    OOPTESample.make            February 1, 1990
  23. #                    TECommon.h                    February 1, 1990
  24. #                    TESampleGlue.a                February 1, 1990
  25. #                    TESample.r                    February 1, 1990
  26. #                    TMLRules.make                February 1, 1990
  27. #                    UApplication.p                February 1, 1990
  28. #                    UApplication.inc1.p            February 1, 1990
  29. #                    UDocument.p                    February 1, 1990
  30. #                    UDocument.inc1.p            February 1, 1990
  31. #                    UTEDocument.p                February 1, 1990
  32. #                    UTEDocument.inc1.p            February 1, 1990
  33. #                    UTESample.p                    February 1, 1990
  34. #                    UTESample.inc1.p            February 1, 1990
  35. #
  36. ---------------------------------------------------------------------*/
  37.  
  38. #ifndef TECommon_Defs
  39. #define TECommon_Defs
  40.  
  41. /*
  42.     These definitions are shared by Rez and C++. We use #define statements
  43.     instead of constants in this file because Rez doesn't support constants,
  44.     and since the 3.0b1 version of Rez doesn't like the C++ comments, we use
  45.     C style comments in this file as well.
  46.  */
  47.  
  48. /*    Determining an application's minimum size to request from MultiFinder depends
  49.     on many things, each of which can be unique to an application's function,
  50.     the anticipated environment, the developer's attitude of what constitutes
  51.     reasonable functionality and performance, etc. Here is a list of some things to
  52.     consider when determining the minimum size (and preferred size) for your
  53.     application. The list is pretty much in order of importance, but by no means
  54.     complete.
  55.     
  56.     1.    What is the minimum size needed to give almost 100 percent assurance
  57.         that the application won't crash because it ran out of memory? This
  58.         includes not only things that you do have direct control over such as
  59.         checking for NIL handles and pointers, but also things that some
  60.         feel are not so much under their control such as QuickDraw and the
  61.         Segment Loader.
  62.         
  63.     2.    What kind of performance can a user expect from the application when
  64.         it is running in the minimum memory configuration? Performance includes
  65.         not only speed in handling data, but also things like how many documents
  66.         can be opened, etc.
  67.         
  68.     3.    What are the typical sizes of scraps that a user might wish to work
  69.         with when lauching or switching to your application? If the amount
  70.         of memory is too small, the scrap will be purged from memory. This
  71.         can be quite frustrating to the user.
  72.         
  73.     4.    The previous items have concentrated on topics that tend to cause an
  74.         increase in the minimum size to request from MultiFinder. On the flip
  75.         side, however, should be the consideration of what environments the
  76.         application may be running in. There may be a high probability that
  77.         many users with relatively small memory configurations will want to
  78.         avail themselves of your application. Or, many users might want to use it
  79.         while several other, possibly related/complementary applications are
  80.         running. If that is the case, it would be helpful to have a fairly
  81.         small minimum size.
  82.     
  83.     What we did for CPlusTESample:
  84.     
  85.         We determined the smallest heap size that CPlusTESample could have and
  86.         still run (24K). For the preferred size we added enough space to permit:
  87.             a. a maximum size TextEdit text handle (32000 characters)
  88.             b. a maximum usable TextEdit scrap (32000 characters)
  89.             b. a maximum scrap as a result of Copy (32000 characters)
  90.             d. a little performance cushion (see 2, above) (10K)
  91.         Result: 124K for preferred size
  92.         
  93.         For the minimum size we took the 22K and then scaled down our requirements
  94.         for a,b, and c above. We thought that providing 16K more would be lean
  95.         and mean (see 4, above).
  96.         Result: 40K for minimum size
  97. */
  98.  
  99. #define kPrefSize                124
  100. #define kMinSize                40
  101.     
  102. /* kMinHeap - This is the minimum result from the following
  103.      equation:
  104.             
  105.             ORD(GetApplLimit) - ORD(ApplicZone)
  106.             
  107.      for the application to run. It will insure that enough memory will
  108.      be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  109.      application, and still give the application some 'breathing room'.
  110.      To derive this number, we ran under a MultiFinder partition that was
  111.      our requested minimum size, as given in the 'SIZE' resource. */
  112.      
  113. #define    kMinHeap                 (34 * 1024)
  114.     
  115. /* kMinSpace - This is the minimum result from PurgeSpace, when called
  116.      at initialization time, for the application to run. This number acts
  117.      as a double-check to insure that there really is enough memory for the
  118.      application to run, including what has been taken up already by
  119.      pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  120.      
  121. #define    kMinSpace                (20 * 1024)
  122.  
  123. /* id of our STR# for error strings */
  124. #define kTEDocErrStrings     129
  125.  
  126. /* The following are indicies into STR# resources. */
  127. #define    eNoMemory                1
  128. #define    eNoSpaceCut                2
  129. #define    eNoCut                    3
  130. #define    eNoCopy                    4
  131. #define    eExceedPaste            5
  132. #define    eNoSpacePaste            6
  133. #define    eNoWindow                7
  134. #define    eExceedChar                8
  135. #define    eNoPaste                9
  136.  
  137. #define    rMenuBar    128                /* application's menu bar */
  138. #define    rAboutAlert    128                /* about alert */
  139. #define    rDocWindow    128                /* application's window */
  140. #define    rVScroll    128                /* vertical scrollbar control */
  141. #define    rHScroll    129                /* horizontal scrollbar control */
  142.  
  143. /* The following constants are used to identify menus and their items. The menu IDs
  144.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  145. #define    mApple                    128        /* Apple menu */
  146. #define    iAbout                    1
  147.  
  148. #define    mFile                    129        /* File menu */
  149. #define    iNew                    1
  150. #define    iClose                    4
  151. #define    iQuit                    12
  152.  
  153. #define    mEdit                    130        /* Edit menu */
  154. #define    iUndo                    1
  155. #define    iCut                    3
  156. #define    iCopy                    4
  157. #define    iPaste                    5
  158. #define    iClear                    6
  159.  
  160. #endif TECommon_Defs
  161.